<?php
/**
 * @CopyRight  (C)2006-2011 OE Development team Inc.
 * @WebSite    www.phpcoo.com，www.oecms.cn
 * @Author     XiangFeng <phpzac@foxmail.com>
 * @Brief      OEcms v3.x
 * @Update     2011.09.01
 * @Id         在线留言
**/
if(!defined('ALLOWGUEST')) {
	exit('Access Denied');
}
$action = Core_Fun::rec_post("action");
if($action=="saveadd"){
	$title    = Core_Fun::rec_post("title",1);
	$contact  = Core_Fun::rec_post("contact",1);
	$content  = Core_Fun::rec_post("content",1);
	$founderr  = false;
	/*if(!Core_Fun::ischar($bookuser)){
		$founderr = true;
		$errmsg  .= "姓名不能为空<br />";
	}
	if($founderr==true){
		Core_Fun::halt($errmsg,"",1);
	}*/
	$bookid = $db->fetch_newid("SELECT MAX(bookid) FROM ".DB_PREFIX."guestbook",1);
	$array  = array(
		'bookid'=>$bookid,
		'bookuser'=>$title,
		'contact'=>$contact,
		'content'=>$content,
		'booktimeline'=>time(),
		'ip'=>Core_Fun::getip(),
		'flag'=>1,
	);

	$db->insert(DB_PREFIX."guestbook",$array);
	echo 2;exit;
	if($urlsuffix=='php'){
		$url = PATH_URL."guestbook.php";
	}else{
		if($config['routeurltype']==1){
			$url = PATH_URL."guestbook.html";
		}else{
			$url = PATH_URL."guestbook";
		}
	}
	Core_Fun::halt("留言成功，我们将会尽快给您联系，感谢您的支持！","$url",0);

}else{
	$page_title = $LANVAR['guestbook'];
	$tpl->assign("page_title",$page_title."-".$config['sitename']);
	$tpl->assign("page_metadescription",$config['metadescription']);
	$tpl->assign("page_metakeyword",$config['metakeyword']);
}
?>